package com.trg.generaltool.service.rabbitmq.conform.topics;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @ClassName: CustomerTopics
 * @Description:
 * @Author: tangrg
 * @Date: 2021/7/19 16:46
 * @Version: 1.0
 * @Return:
 **/
@Component
public class CustomerTopics {

    @RabbitListener(
          bindings = @QueueBinding(
                  value = @Queue, //默认队列名称
                  exchange = @Exchange(value = "topics",type = "topic"),
                  key = {"deal.*"}
          )
    )
    public void rec1() {
        rec1();
    }

    @RabbitListener(
          bindings = @QueueBinding(
                  value = @Queue, //默认队列名称
                  exchange = @Exchange(value = "topics",type = "topic"),
                  key = {"deal.*"}
          )
    )
    public void rec1(String msg){
        System.out.println("msg1:" + msg);
    }

    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue, //默认队列名称
                    exchange = @Exchange(value = "topics",type = "topic"),
                    key = {"*.#"}
            )
    )
    public void rec2(String msg){
        System.out.println("msg2:" + msg);
    }
}
